import 'package:flower_flutter/provider/provider_state.dart';
import 'package:flower_flutter/widget/provider_state_page_1.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class ProviderPage_2 extends StatefulWidget {
  @override
  ProviderPage_2State createState() =>  ProviderPage_2State();
}

class ProviderPage_2State extends State<ProviderPage_2> {
  ProviderState providerState;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(''),
      ),
      body: Consumer(builder: (context, ProviderState state, _) {
        print('Consumer============');
        providerState=state;
        return Container(
          width: double.infinity,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              Text(providerState.userModel.age.toString()??'0'),
              SizedBox(height: 150),
              GestureDetector(
                onTap: (){
                  Navigator.push(context, MaterialPageRoute(builder: (context) => StatePage_1()));
                },
                child: Text('下一页'),
              ),
            ],
          ),
        );
      }),
    );
  }
}
